<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <title>文章管理接口测试用例文档</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            margin: 20px;
        }

        h1,
        h2,
        h3 {
            color: #333;
        }

        pre {
            background-color: #f4f4f4;
            padding: 10px;
            border-radius: 5px;
            overflow-x: auto;
        }

        code {
            background-color: #eee;
            padding: 2px 4px;
            border-radius: 3px;
        }

        table {
            border-collapse: collapse;
            width: 100%;
            margin-bottom: 20px;
        }

        th,
        td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
        }
    </style>
</head>

<body>
    <h1>文章管理接口测试用例文档</h1>
    <p>本测试用例文档适用于对 <code>添加文章</code>、<code>获取所有文章</code>、<code>获取单篇文章</code>、<code>更新文章</code>、<code>删除文章</code>
        接口进行功能测试。</p>

    <hr />

    <h2>1. 添加文章 (<code>/articles</code>) 测试用例</h2>
    <table>
        <tr>
            <th>编号</th>
            <th>用例描述</th>
            <th>请求方式</th>
            <th>title</th>
            <th>content</th>
            <th>author</th>
            <th>publishedAt</th>
            <th>预期状态码</th>
            <th>预期结果</th>
        </tr>
        <tr>
            <td>A01</td>
            <td>添加成功</td>
            <td>POST</td>
            <td>测试文章</td>
            <td>内容</td>
            <td>张三</td>
            <td>2025-06-10T12:00:00.000Z</td>
            <td>30000</td>
            <td>文章添加成功</td>
        </tr>
        <tr>
            <td>A02</td>
            <td>缺少标题</td>
            <td>POST</td>
            <td>（空）</td>
            <td>内容</td>
            <td>张三</td>
            <td>2025-06-10T12:00:00.000Z</td>
            <td>30001</td>
            <td>标题、内容和作者为必填项</td>
        </tr>
        <tr>
            <td>A03</td>
            <td>缺少内容</td>
            <td>POST</td>
            <td>测试文章</td>
            <td>（空）</td>
            <td>张三</td>
            <td>2025-06-10T12:00:00.000Z</td>
            <td>30001</td>
            <td>标题、内容和作者为必填项</td>
        </tr>
        <tr>
            <td>A04</td>
            <td>缺少作者</td>
            <td>POST</td>
            <td>测试文章</td>
            <td>内容</td>
            <td>（空）</td>
            <td>2025-06-10T12:00:00.000Z</td>
            <td>30001</td>
            <td>标题、内容和作者为必填项</td>
        </tr>
        <tr>
            <td>A05</td>
            <td>只填必填项</td>
            <td>POST</td>
            <td>必填文章</td>
            <td>内容</td>
            <td>李四</td>
            <td>（空）</td>
            <td>30000</td>
            <td>文章添加成功</td>
        </tr>
    </table>

    <hr />

    <h2>2. 获取所有文章 (<code>/articles</code>) 测试用例</h2>
    <table>
        <tr>
            <th>编号</th>
            <th>用例描述</th>
            <th>请求方式</th>
            <th>预期状态码</th>
            <th>预期结果</th>
        </tr>
        <tr>
            <td>G01</td>
            <td>返回文章列表</td>
            <td>GET</td>
            <td>30000</td>
            <td>返回文章数组</td>
        </tr>
        <tr>
            <td>G02</td>
            <td>无文章时返回空数组</td>
            <td>GET</td>
            <td>30000</td>
            <td>返回空数组</td>
        </tr>
    </table>

    <hr />

    <h2>3. 获取单篇文章 (<code>/articles/:id</code>) 测试用例</h2>
    <table>
        <tr>
            <th>编号</th>
            <th>用例描述</th>
            <th>请求方式</th>
            <th>id</th>
            <th>预期状态码</th>
            <th>预期结果</th>
        </tr>
        <tr>
            <td>S01</td>
            <td>获取成功</td>
            <td>GET</td>
            <td>1</td>
            <td>30000</td>
            <td>返回对应文章信息</td>
        </tr>
        <tr>
            <td>S02</td>
            <td>文章不存在</td>
            <td>GET</td>
            <td>9999</td>
            <td>30002</td>
            <td>文章未找到</td>
        </tr>
        <tr>
            <td>S03</td>
            <td>id 非数字</td>
            <td>GET</td>
            <td>abc</td>
            <td>50000</td>
            <td>服务器错误</td>
        </tr>
    </table>

    <hr />

    <h2>4. 更新文章 (<code>/articles/:id</code>) 测试用例</h2>
    <table>
        <tr>
            <th>编号</th>
            <th>用例描述</th>
            <th>请求方式</th>
            <th>id</th>
            <th>title</th>
            <th>content</th>
            <th>author</th>
            <th>publishedAt</th>
            <th>预期状态码</th>
            <th>预期结果</th>
        </tr>
        <tr>
            <td>U01</td>
            <td>全部字段更新</td>
            <td>PUT</td>
            <td>1</td>
            <td>新标题</td>
            <td>新内容</td>
            <td>李四</td>
            <td>2025-06-11T12:00:00.000Z</td>
            <td>30000</td>
            <td>文章更新成功</td>
        </tr>
        <tr>
            <td>U02</td>
            <td>只更新部分字段</td>
            <td>PUT</td>
            <td>1</td>
            <td>新标题</td>
            <td>（空）</td>
            <td>（空）</td>
            <td>（空）</td>
            <td>30000</td>
            <td>文章更新成功</td>
        </tr>
        <tr>
            <td>U03</td>
            <td>文章不存在</td>
            <td>PUT</td>
            <td>9999</td>
            <td>新标题</td>
            <td>新内容</td>
            <td>李四</td>
            <td>2025-06-11T12:00:00.000Z</td>
            <td>30002</td>
            <td>文章未找到</td>
        </tr>
        <tr>
            <td>U04</td>
            <td>id 非数字</td>
            <td>PUT</td>
            <td>abc</td>
            <td>新标题</td>
            <td>新内容</td>
            <td>李四</td>
            <td>2025-06-11T12:00:00.000Z</td>
            <td>50000</td>
            <td>服务器错误</td>
        </tr>
    </table>
</body>

</html>